#include<iostream>
#include "zthread/ThreadedExecutor.h"
#include "zthread/PoolExecutor.h"
#include "LiftOff.h"

using namespace std;
using namespace ZThread;

void threaded_executor()
{
	try
	{
		ThreadedExecutor executor;
		for(int i=0;i<5;i++)
		{
			executor.execute(new LiftOff(10,i));
		}
	}
	catch(Synchronization_Exception& e)
	{
		cerr<<e.what()<<endl;
	}

}

void pool_executor()
{
	try
	{
		//constructor argument is minimum number of threads
		PoolExecutor executor(3);
		for(int i=0;i<5;i++)
		{
			executor.execute(new LiftOff(10,i));
		}
	}
	catch(Synchronization_Exception& e)
	{
		cerr<<e.what()<<endl;
	}
}

int main()
{
//	threaded_executor();
	pool_executor();
	return 0;
}

